/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.repair.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.ibatis.annotations.Param;
import org.springblade.modules.repair.dto.sign.SignDetailSearchDTO;
import org.springblade.modules.repair.entity.MaintainSignCalendar;
import org.springblade.modules.repair.entity.UserSignDetail;
import org.springblade.modules.repair.vo.HomeUserSignCountVO;
import org.springblade.modules.repair.vo.UserSignDetailVO;
import org.springblade.modules.repair.vo.plan.SignRangeVo;
import org.springblade.modules.repair.vo.sign.SignWorkUserVo;
import org.springblade.modules.system.vo.UserVO;

import java.util.List;

/**
 * 用户签到明细表 Mapper 接口
 *
 * @author zcc
 * @since 2021-07-28
 */
public interface UserSignDetailMapper extends BaseMapper<UserSignDetail> {

	/**
	 * 自定义分页
	 *
	 * @param page
	 * @param userSignDetail
	 * @return
	 */
	List<UserSignDetailVO> selectUserSignDetailPage(IPage page, UserSignDetailVO userSignDetail);

	/**
	 * 根据用户ID 获取考勤经纬度
	 *
	 * @param tenantId 租户ID
	 * @param userId 用户id
	 * @return 数据集
	 */
    List<SignRangeVo> getSignRangeVoList(@Param("tenantId")String tenantId, @Param("userId") Long userId);

	/**
	 * 获取月份的考勤数据
	 * @param userId 用户id
	 * @param beginDate 开始时间
	 * @param endDate 结束时间
	 * @return 数据集
	 */
    List<UserSignDetail> list(@Param("userId") Long userId,@Param("beginDate") Integer beginDate,@Param("endDate") Integer endDate);

	/**
	 * 获取当天的考勤数据
	 * @param userId
	 * @param today
	 * @return
	 */
	MaintainSignCalendar getOne(@Param("userId") Long userId, @Param("today") Integer today);

	/**
	 * 获取休息日的上班用户名称
	 * @param signDetailSearchDTO 查询条件
	 * @return 数据集
	 */
    List<UserSignDetail> getRestUserSignDetail(@Param("signDetailSearchDTO") SignDetailSearchDTO signDetailSearchDTO);

	/**
	 * 获取考勤的在职工作人员
	 * @param userIds 用户ids
	 * @return 数据集
	 */
	List<SignWorkUserVo> getWorkUserList(List<Long> userIds);

	/**
	 * 获取某个时间段在线人员
	 * @param signDetailSearchDTO 查询条件
	 * @return 数据集
	 */
	List<UserVO> getWorkUserListByDate(@Param("signDetailSearchDTO") SignDetailSearchDTO signDetailSearchDTO);

	HomeUserSignCountVO selectUserSignMonthCount(@Param("userId") Long userId,@Param("monthFirstDay") String monthFirstDay,@Param("yesterday") String yesterday);
}
